//
//  DXPaperSection.m
//  suremodv
//
//  Created by dd on 13-10-30.
//  Copyright (c) 2013年 xiaomuzhi. All rights reserved.
//

#import "DXPaperSection.h"

@implementation DXPaperSection

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        // Initialization code
        
        _contentHeight = 49;
        
        _bodyHolder = [[UIView alloc] initWithFrame:CGRectMake(9.5, 20 - 0.5, 301, _contentHeight)];
        _bodyHolder.backgroundColor = [UIColor whiteColor];
        _bodyHolder.layer.borderWidth = 0.5;
        _bodyHolder.layer.borderColor = [DX colorWithRed:211 green:211 blue:211 alpha:1].CGColor;
        [self addSubview:_bodyHolder];
        
        _body = [[UIView alloc] initWithFrame:CGRectMake(21.5, 20 - 0.5, 277.5, _contentHeight)];
        _body.backgroundColor = [UIColor whiteColor];
        _body.layer.borderWidth = 0.5;
        _body.layer.borderColor = [DX colorWithRed:211 green:211 blue:211 alpha:1].CGColor;
        [self addSubview:_body];
        
        _top = [[UIImageView alloc] initWithFrame:CGRectMake(9.5, 0, 301, 20)];
        _top.image = [UIImage imageNamed:@"section_paper_top"];
        [self addSubview:_top];
        
        _bottom = [[UIImageView alloc] initWithFrame:CGRectMake(9.5, 19 + _contentHeight , 301, 20)];
        _bottom.image = [UIImage imageNamed:@"section_paper_bottom"];
        [self addSubview:_bottom];
        
        UIImageView *icon = [[UIImageView alloc] initWithFrame:CGRectMake(33, 21, 12, 16)];
        icon.image = [UIImage imageNamed:@"icon_detail"];
        [self addSubview:icon];
        
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(53, 23, 200, 15)];
        _titleLabel.backgroundColor = [UIColor clearColor];
        _titleLabel.textColor = [DX colorDeepBlack];
        _titleLabel.font = [UIFont systemFontOfSize:14];
        [self addSubview:_titleLabel];
        
        UIImageView *line = [[UIImageView alloc] initWithFrame:CGRectMake(28.5, 49, 263, 2)];
        line.image = [UIImage imageNamed:@"section_line"];
        [self addSubview:line];
    }
    return self;
}

- (void)setContentHeight:(float)height
{
    _contentHeight = height;
    _bodyHolder.frame = CGRectMake(9.5, 20 - 0.5, 301, _contentHeight);
    _body.frame = CGRectMake(21.5, 20 - 0.5, 277.5, _contentHeight);
    _bottom.frame = CGRectMake(9.5, 19 + _contentHeight , 301, 20);
}

- (void)setTitle:(NSString *)title
{
    _titleLabel.text = title;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
